package com.itheima.day14.CountDownLatch.test1;

import java.util.concurrent.CountDownLatch;

public class Test {
    public static void main(String[] args) {
        // 创建CountDownLatch对象，需要传递4个线程
        CountDownLatch countDownLatch = new CountDownLatch(3);

        // 创建妈妈和孩子线程，并开启他们
        MotherThread mt = new MotherThread(countDownLatch);
        mt.setName("妈妈");
        mt.start();

        ChileThread1 c1 = new ChileThread1(countDownLatch);
        c1.setName("小张");
        c1.start();

        ChileThread1 c2 = new ChileThread1(countDownLatch);
        c2.setName("小凡");
        c2.start();

        ChileThread1 c3 = new ChileThread1(countDownLatch);
        c3.setName("小皮");
        c3.start();
    }
}
